<!--
 * @Description: 颜色选择框
 * @Author: zhangwei
 color属性有些特殊，不能通过myButton.value.ref.addEventListener("focus", handleClick) 组件的ref的值来添加事件
-->
<template>
  <AttrCmpBase :mconfig="config">
    <el-color-picker v-bind="config.attrs" v-model="data[config.key]" @change="changeValue" />
  </AttrCmpBase>
</template>

<script lang="ts">
import { defineComponent, onMounted, ref } from "vue";
import AttrCmpMixins from "../../AttrCmpMixin";

export default defineComponent({
  name: "AColorPicker",
  mixins: [AttrCmpMixins],
  emits: [],
  props: {},
  setup(props) {
    // eslint-disable-next-line vue/no-setup-props-destructure

    let events = props.config.events;
    const changeValue = (value: string) => {
      events.forEach((_event) => {
        if (_event.name == "change") {
          eval(_event.func);
        }
      });
    };

    return {
      changeValue,
    };
  },
});
</script>
<style scoped lang="scss"></style>
